@extends('admin.layout.app')
@section('title', '权限分配')

@section('nav')
    @include('admin.layout.nav', ['title'=> ['系统管理','权限分配']])
@endsection

@section('content')
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">权限分配</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <h3>角色：{{$role->display_name}}</h3>
            <form action="" method="post" autocomplete="off">
                {{csrf_field()}}
                <input type="text" value="{{$role->id}}" name="id" style="display: none;" />
                <div class="form-group">
                    {{--<label for="description">角色：</label>--}}
                    <select multiple="multiple" class="form-control" name="assign-permissions[]">
                        @foreach($permissions as $permission)
                            <option value="{{$permission->id}}" @if($permission->selected) selected @endif>{{$permission->display_name}}</option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary">提交</button>
                    <a class="btn btn-default pull-right" href="javascript:window.history.back();">返回</a>
                </div>
            </form>
        </div>
        <!-- /.box-body -->
        <div class="box-footer clearfix">
        </div>
    </div>
@endsection

@section('style')
    <link rel="stylesheet" href="/AdminLTE-2.4.2/plugins/duallistbox-bootstrap/bootstrap-duallistbox.min.css" />
    <style>

    </style>
@endsection

@section('js')

    <script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="/AdminLTE-2.4.2/plugins/duallistbox-bootstrap/jquery.bootstrap-duallistbox.min.js"></script>
    <script >
        var demo1 = $('select[name="assign-permissions[]"]').bootstrapDualListbox({
            nonSelectedListLabel: '可分配权限',
            selectedListLabel: '已分配权限',
            moveOnSelect: false,
        });
        $(function () {
        })
    </script>
@endsection